Skip to content

Typing of Task id#16

Closed
sliterok wants to merge 1 commit into
onury:masterfrom
sliterok:patch-1
Closed

Typing of Task id#16
sliterok wants to merge 1 commit into
onury:masterfrom
sliterok:patch-1

Conversation

@sliterok

Copy link
Copy Markdown

You should warn about task id being string in Task constructor itself instead of silently converting, because in TaskTimer.remove() method of it would throw an error in case when user would provide any other type than string.

Either you could edit .remove() method for it to convert id argument to string.

You should warn about task id being string in Task constructor itself instead of silently converting, because in TaskTimer.remove() method of it would throw an error in case when user would provide any other type than string.
@onury

onury commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Thanks for this. I'd rather keep the coercion than throw: id is typed string, and String() normalizes the rare non-string at the boundary — the same single, predictable-type approach I use elsewhere. And remove() reads task.id, which is already that coerced string, so there's no asymmetry to guard against. Declining for that reason, but I appreciate the report.

(For what it's worth, v4 adds a TaskTimerError with a stable err.code for the errors the library does throw.) Closing.

@onury onury closed this Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants